]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Login: sensitivity fixes
authorStéphane Démurget <stephane.demurget@free.fr>
Sun, 18 Nov 2012 21:36:17 +0000 (22:36 +0100)
committerStéphane Démurget <stephane.demurget@free.fr>
Tue, 20 Nov 2012 20:08:37 +0000 (21:08 +0100)
The login dialog had these issues:
  - the entry was not really disabled, you could still edit text
  - the sensitivity state was not reset on verification failure
  - the session list was not disabled

The unlock dialog had these issues:
  - "Login as another user..." was not insensitive
  - redundant password char setting, overwriting the one given by the
    question

The entry insensitive style was also wrong.

https://bugzilla.gnome.org/show_bug.cgi?id=687113

data/theme/gnome-shell.css
js/gdm/loginDialog.js
js/ui/unlockDialog.js

index 403812012c0a156f9d54f8c4da8850ec799d97d3..e99acb059c5020833d750e19dab29db5b3c083c3 100644 (file)
@@ -405,11 +405,13 @@ StScrollBar StButton#vhandle:active {
     padding: 0 4px;
 }
 
-.login-dialog-prompt-entry:insensitive {
-    color: rgba(0,0,0,0.7);
-    border: 2px solid #565656;
-    background-gradient-start: rgb(200,200,200);
-    background-gradient-end: rgb(210,210,210);
+.modal-dialog StEntry:insensitive {
+    border-color: #666666;
+    color: #9f9f9f;
+    border: 2px solid #9f9f9f;
+    background-gradient-direction: none;
+    background-color: rgba(102, 102, 102, 0.15);
+    box-shadow: inset 0 0 rgba(0,0,0,1.0);
 }
 
 /* Panel */
index 3db832e29b9cfaf1e30c7a8ae7c309c03caaeb2a..c72ce4781b64422982c8b433fd020df340568f4e 100644 (file)
@@ -604,6 +604,14 @@ const SessionList = new Lang.Class({
             this.close();
     },
 
+    updateSensitivity: function(sensitive) {
+        this._button.reactive = sensitive;
+        this._button.can_focus = sensitive;
+
+        for (let id in this._items)
+            this._items[id].actor.reactive = sensitive;
+    },
+
     setActiveSession: function(sessionId) {
          if (sessionId == this._activeSessionId)
              return;
@@ -685,6 +693,7 @@ const LoginDialog = new Lang.Class({
         this._userVerifier = new GdmUtil.ShellUserVerifier(this._greeterClient);
         this._userVerifier.connect('ask-question', Lang.bind(this, this._askQuestion));
         this._userVerifier.connect('show-message', Lang.bind(this, this._showMessage));
+        this._userVerifier.connect('verification-failed', Lang.bind(this, this._verificationFailed));
         this._userVerifier.connect('reset', Lang.bind(this, this._reset));
         this._userVerifier.connect('show-login-hint', Lang.bind(this, this._showLoginHint));
         this._userVerifier.connect('hide-login-hint', Lang.bind(this, this._hideLoginHint));
@@ -750,6 +759,8 @@ const LoginDialog = new Lang.Class({
         this._promptLoginHint.hide();
         this._promptBox.add(this._promptLoginHint);
 
+        this._signInButton = null;
+
         this._sessionList = new SessionList();
         this._sessionList.connect('session-activated',
                                   Lang.bind(this, function(list, sessionId) {
@@ -829,6 +840,7 @@ const LoginDialog = new Lang.Class({
     },
 
     _reset: function() {
+        this._updateSensitivity(true);
         this._promptMessage.hide();
         this._user = null;
         this._verifyingUser = false;
@@ -839,6 +851,12 @@ const LoginDialog = new Lang.Class({
             this._showUserList();
     },
 
+    _verificationFailed: function() {
+        this._promptEntry.text = '';
+
+        this._updateSensitivity(true);
+    },
+
     _onDefaultSessionChanged: function(client, sessionId) {
         this._sessionList.setActiveSession(sessionId);
     },
@@ -928,16 +946,15 @@ const LoginDialog = new Lang.Class({
 
                      function() {
                          this.setButtons(buttons);
+                         this._signInButton = okButtonInfo.button;
 
-                         let updateOkButtonEnabled = Lang.bind(this, function() {
-                             let sensitive = this._promptEntry.text.length > 0;
-                             okButtonInfo.button.reactive = sensitive;
-                             okButtonInfo.button.can_focus = sensitive;
-                         });
-
-                         updateOkButtonEnabled();
+                         this._updateSignInButtonSensitivity(this._promptEntry.text.length > 0);
 
-                         this._promptEntryTextChangedId = this._promptEntry.clutter_text.connect('text-changed', updateOkButtonEnabled);
+                         this._promptEntryTextChangedId =
+                             this._promptEntry.clutter_text.connect('text-changed',
+                                                                    Lang.bind(this, function() {
+                                                                        this._updateSignInButtonSensitivity(this._promptEntry.text.length > 0);
+                                                                    }));
                      },
 
                      hold];
@@ -947,6 +964,20 @@ const LoginDialog = new Lang.Class({
         return batch.run();
     },
 
+    _updateSensitivity: function(sensitive) {
+        this._promptEntry.reactive = sensitive;
+        this._promptEntry.clutter_text.editable = sensitive;
+        this._sessionList.updateSensitivity(sensitive);
+        this._updateSignInButtonSensitivity(sensitive);
+    },
+
+    _updateSignInButtonSensitivity: function(sensitive) {
+        if (this._signInButton) {
+            this._signInButton.reactive = sensitive;
+            this._signInButton.can_focus = sensitive;
+        }
+    },
+
     _hidePrompt: function() {
         this.setButtons([]);
 
@@ -961,8 +992,11 @@ const LoginDialog = new Lang.Class({
 
                      function() {
                          this._promptLoginHint.hide();
-                         this._promptEntry.reactive = true;
+
+                         this._updateSensitivity(true);
                          this._promptEntry.set_text('');
+
+                         this._signInButton = null;
                      }];
 
         let batch = new Batch.ConsecutiveBatch(this, tasks);
@@ -981,9 +1015,9 @@ const LoginDialog = new Lang.Class({
                      },
 
                      function() {
-                         let _text = this._promptEntry.get_text();
-                         this._promptEntry.reactive = false;
-                         this._userVerifier.answerQuery(serviceName, _text);
+                         let text = this._promptEntry.get_text();
+                         this._updateSensitivity(false);
+                         this._userVerifier.answerQuery(serviceName, text);
                      }];
 
         let batch = new Batch.ConsecutiveBatch(this, tasks);
index 98ff22aaca8be1cb442f6ab413847e2c73f70d56..548bbe7688e0d90aeac3942fec82c2d66187c4df 100644 (file)
@@ -176,8 +176,6 @@ const UnlockDialog = new Lang.Class({
                            default: true };
         this.setButtons([cancelButton, this._okButton]);
 
-        this._updateSensitivity(true);
-
         let otherUserLabel = new St.Label({ text: _("Log in as another user"),
                                             style_class: 'login-dialog-not-listed-label' });
         this._otherUserButton = new St.Button({ style_class: 'login-dialog-not-listed-button',
@@ -191,6 +189,8 @@ const UnlockDialog = new Lang.Class({
                               { x_align: St.Align.START,
                                 x_fill: false });
 
+        this._updateSensitivity(true);
+
         let batch = new Batch.Hold();
         this._userVerifier.begin(this._userName, batch);
 
@@ -209,6 +209,8 @@ const UnlockDialog = new Lang.Class({
         this._promptEntry.reactive = sensitive;
         this._promptEntry.clutter_text.editable = sensitive;
         this._updateOkButtonSensitivity(sensitive && this._promptEntry.text.length > 0);
+        this._otherUserButton.reactive = sensitive;
+        this._otherUserButton.can_focus = sensitive;
     },
 
     _updateOkButtonSensitivity: function(sensitive) {
@@ -292,8 +294,6 @@ const UnlockDialog = new Lang.Class({
         this._firstQuestion = true;
 
         this._promptEntry.text = '';
-        this._promptEntry.clutter_text.set_password_char('\u25cf');
-        this._promptEntry.menu.isPassword = true;
 
         this._updateSensitivity(false);
     },